package day6;
import com.sun.source.tree.NewArrayTree;
import org.w3c.dom.ls.LSOutput;

import java.lang.invoke.VarHandle;
import java.lang.reflect.Array;
import java.sql.SQLOutput;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;

class MyClass {
    int NUM;
    MyClass(int num) {
        this.NUM = num;
    }
}
class Himclass extends MyClass implements Comparable<Himclass> {
    Himclass(int num,String ST) {
        super(num);
        name=ST;
    }
    String name;
    public int compareTo(Himclass o) {
        return NUM - o.NUM;
    }
    @Override
    public String toString() {
        return NUM+":"+name;
    }
}
public class frame {
    public static void main(String[] args) {
        Himclass[] HIM={new Himclass(12,"A"),
                new Himclass(4,"H"),
                new Himclass(8,"Z"),
                new Himclass(1,"B"),};
        Arrays.sort(HIM);
        System.out.println(Arrays.toString(HIM));
    }
}
